package com.common.metric.config;

import com.common.metric.processor.MonitorAnnotationBeanPostProcessor;
import com.common.metric.processor.ThreadPoolMonitorProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: Sunny
 * @date: 2021/2/7
 * @version: v1.0.0
 */
@Configuration
public class MetricAutoConfigure {

    @Bean
    public ThreadPoolMonitorProcessor threadPoolMonitorProcessor() {
        return new ThreadPoolMonitorProcessor();
    }

    @Bean
    public MonitorAnnotationBeanPostProcessor monitorAnnotationBeanPostProcessor(ThreadPoolMonitorProcessor threadPoolMonitorProcessor) {
        MonitorAnnotationBeanPostProcessor processor =  new MonitorAnnotationBeanPostProcessor();
        processor.addProcessor(threadPoolMonitorProcessor);
        return processor;
    }

}
